-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event-based Puzzles #47
Event-based Puzzles #47
Conversation
Making puzzles be owned by events, as a way to play with object relationships. The "CLICK HERE TO CHECK YOUR DATABASE SETUP" link now points to Events instead of Puzzles, and the Events index has a new link to access that event's puzzle list. I've needed to pass the event ID around, and the event ID should probably be part of some global context, but this is a helpful microcosm of issues we'll have when doing other features so I still think it's a good start.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for figuring this event stuff out!
ServerCore/Pages/Events/Index.cshtml
Outdated
@@ -19,6 +19,7 @@ | |||
<th> | |||
@Html.DisplayNameFor(model => model.Event[0].UrlString) | |||
</th> | |||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please remove commented out code.
@@ -27,17 +28,21 @@ public IActionResult OnGet() | |||
[BindProperty] | |||
public Puzzle Puzzle { get; set; } | |||
|
|||
public async Task<IActionResult> OnPostAsync() | |||
public async Task<IActionResult> OnPostAsync(int? eventid) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we require having an event id? We probably don't want puzzles that aren't in events
_context.Puzzle.Add(Puzzle); | ||
await _context.SaveChangesAsync(); | ||
|
||
return RedirectToPage("./Index"); | ||
return RedirectToPage("./Index", new { eventid = eventid }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @asyasky, take a look at how we should be doing this (but no need to block on this)
{ | ||
Puzzle = await _context.Puzzle.ToListAsync(); | ||
if (eventid != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please file an issue tracking removing the null tolerance since we don't want people accidentally wandering into all puzzles in all events
Changes made, thanks! |
Making puzzles be owned by events, as a way to play with object
relationships.
The "CLICK HERE TO CHECK YOUR DATABASE SETUP" link now points to Events
instead of Puzzles, and the Events index has a new link to access that
event's puzzle list.
I've needed to pass the event ID around, and the event ID should
probably be part of some global context, but this is a helpful microcosm
of issues we'll have when doing other features so I still think it's a
good start.